package com.swx.identityservice.models;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Table(name = "scbp_user")
@Data
@ApiModel(value = "用户信息实体类")
public class ScbpUser  {

    @Id
    @Column(name = "Id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @JsonIgnore
    @Transient
    private List<ScbpPermission> permissions = new ArrayList<>();

    @NotNull(message = "用户名不能为空")
    @Column(name = "UserName")
    @ApiModelProperty(value = "用户名", example = "小周")
    private String username;


    @JsonIgnore
    @ApiModelProperty(value = "别名",example = "小王")
    @Column(name = "Account")
    private String account;


    @NotNull(message = "联系电话不能为空")
    @Column(name = "PhoneNumber")
    @ApiModelProperty(value = "联系电话",example = "13800138000")
    private String phonenumber;

    @Transient
    private Integer did;

    @Transient
    private Integer uid;
    @Transient
    private Integer dtopid;
    @Transient
    private String dtitle;


//    @Column(name= "Affiliateddept")
    @Transient

    private String affiliateddept;

//    @Column(name= "Affiliatedunit")
    @Transient
    private String  affiliatedunit;


    @Column(name = "LastModifierUserId")
    private Integer lastmodifieruserid;

    @Transient
    private String deptName;


    @Column(name = "IsDeleted")
    private Boolean isdeleted;



    @Column(name = "DeletionTime")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date deletiontime;


    @Column(name = "DeleterUserId")
    private Integer deleteruserid;


    public Integer getId() {
        return id;
    }

    @ApiModelProperty(value = "头像",example = "选择图片")
    @Column(name = "AvatorSrc")
    private String avatorsrc;

    @ApiModelProperty(value = "工作证号",example = "538000138000")
    @Column(name = "WorkNum")
    private String worknum;



    @ApiModelProperty(value = "邮箱",example = "qqwsd@163.com")
    @Column(name = "Email")
    private String email;


    @ApiModelProperty(value = "身份证、军官证号码不能为空",example = "511011199508054158")
    @NotNull(message = "身份证、军官证号码不能为空")
    @Column(name = "IdNumber")
    private String idnumber;

    @Column(name = "RoleIds")
    @ApiModelProperty(value = "角色集合",example = "[1,2,3]")
    @NotNull(message = "先选择角色")
    private String roleids;

    @Column(name = "CardType")
    private String cardtype;

    @Transient
    private String uname;


    // @NotNull
    @Column(name = "IsInformal")
    @NotNull(message = "不能为空")
    private Boolean isinformal;

    @NotNull
//    @Column(name = "Unit")
    @Transient
    private String unit;

    @Transient
    private List<ScbpDept> depts = new ArrayList<>();

    // @NotNull

    @Column(name = "DeptIds")
    private String deptids;

    @Column(name = "UnitIds")
    private String unitids;


    @Transient
    private List<ScbpRole> roles = new ArrayList<>();

    @ApiModelProperty(value = "密码",example = "123456")
    @Column(name = "Password")
    private String password;

    @Column(name = "CreationTime")
//    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date creationtime;

    @Column(name = "CreatorUserId")
    private Integer creatoruserid;

    @Column(name = "LastModificationTime")
//    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastmodificationtime;



}
